package com.vm.runtimedata.heap;

import java.util.ArrayList;
import java.util.List;

/**
 * 演示GC的过程
 * -Xms9m -Xmx9m -XX:+PrintGCDetails
 */
public class GCTest {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        String a = "hello world";
        int i =0;
      try{
          while (true){
              list.add(a);
              a = a + a;
          }
      }catch (Exception e){
          System.out.println("第"+i+"次添加该参数");
          e.printStackTrace();
      }
    }
}
